import Taro from '@tarojs/taro'
import '@tarojs/async-await'

const BASE_URL = 'https://app.easytbk.com/v6';
// const BASE_URL = 'https://api.baicaitao.com/v4';
// const BASE_URL = 'https://api.baicai.top/v4';
// const BASE_URL = 'https://youpin.iwxapp.com/v4';
// const BASE_URL = 'https://test.baicai.top/v4';
// const BASE_URL = 'https://api.quhouqin.cn/v4';
// const BASE_URL = 'https://api.3zq.cn/v4';
// const BASE_URL = 'https://api.hongtang.online/v4';


export function getJSON(url,data){
  Taro.showLoading();
  return Taro.request({url:BASE_URL+url,data,method:'GET'}).then(result=>{
    Taro.hideLoading();
    return result.data;
  });
}

export function  postJSON(url,data){
  Taro.showLoading();
  return Taro.request({ header: {
     'content-type': 'application/json'
   },url:BASE_URL+url,data,method:'POST'}).then(result=>{
     Taro.hideLoading();
     return result.data;
  });
}
export function  post1JSON(url,data){
  Taro.showLoading();
  return  Taro.request({ header: {
      'content-type': 'application/json'
    },url:url,data,method:'POST'}).then(result=>{
    Taro.hideLoading();
    return result.data;
  });
}
export function  putJSON(url,data){
  Taro.showLoading();
  return  Taro.request({ header: {
      'content-type': 'application/json'
    },url:BASE_URL+url,data,method:'PUT'}).then(result=>{
    Taro.hideLoading();
    return result.data;
  });
}
export function  deleteJSON(url,data){
  Taro.showLoading();
  return  Taro.request({ header: {
      'content-type': 'application/json'
    },url:BASE_URL+url,data,method:'DELETE'}).then(result=>{
    Taro.hideLoading();
    return result.data;
  });
}
